package main

type ShoppingCart struct {
	items []Item
}

func (s *ShoppingCart) calculatePrice() float64 {
	visitor := new(Cashier)
	for _, v := range s.items {
		v.accept(visitor)
	}
	total := visitor.getTotal()
	return total
}

func (s *ShoppingCart) add(e Item) {
	s.items = append(s.items, e)
}
